package com.lzx.iteam.receiver;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.lzx.iteam.MainActivity;
import io.rong.push.notification.PushMessageReceiver;
import io.rong.push.notification.PushNotificationMessage;

/**
 * Created with IntelliJ IDEA.
 * **********************************
 * User: zhangshuai
 * Date: 2016年 10月 21日
 * Time: 下午2:40
 *
 * @QQ : 1234567890
 * **********************************
 */
public class RongNotificationReceiver extends PushMessageReceiver {
    private static final String TAG = "Rong_Receiver";
    @Override
    public boolean onNotificationMessageArrived(Context context, PushNotificationMessage pushNotificationMessage) {
        Log.d(TAG, "Arrived :  " + pushNotificationMessage.toString());
        return false;
    }

    @Override
    public boolean onNotificationMessageClicked(Context context, PushNotificationMessage pushNotificationMessage) {
        Log.d(TAG, "Clicked :  " + pushNotificationMessage.toString());
        Intent intent = new Intent(context, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
        context.startActivity(intent);
        return true;
    }
}
